#include "globalconfig.h"

#include <QSettings>

GlobalConfig gConf;
GlobalConfig::GlobalConfig()
{
}

void GlobalConfig::setSettings(QSettings* settings)
{
    this->settings = settings;
}

void GlobalConfig::save()
{
    if(!settings)
        return;
    settings->beginGroup("Global");
    settings->setValue("Interval", interval);
    settings->setValue("MaxTask", maxTask);
    settings->setValue("MinFetchTime", fetchInterval);
    settings->endGroup();
}

void GlobalConfig::load()
{
    if(!settings)
        return;
    settings->beginGroup("Global");
    interval = settings->value("Interval", 1500).toInt();
    maxTask = settings->value("MaxTask", 5).toInt();
    fetchInterval = settings->value("MinFetchTime", 60).toInt();

    settings->endGroup();

}
